﻿using JetBrains.Annotations;

namespace System.Text
{
	internal static class StringBuilderExtensions
	{
		[StringFormatMethod("format")]
		public static void AppendLine(this StringBuilder builder, string format, object arg0)
		{
			builder.AppendFormat(format, arg0);
			builder.AppendLine();
		}

		[StringFormatMethod("format")]
		public static void AppendLine(this StringBuilder builder, string format, object arg0, object arg1)
		{
			builder.AppendFormat(format, arg0, arg1);
			builder.AppendLine();
		}

		[StringFormatMethod("format")]
		public static void AppendLine(this StringBuilder builder, string format, object arg0, object arg1, object arg2)
		{
			builder.AppendFormat(format, arg0, arg1, arg2);
			builder.AppendLine();
		}

		[StringFormatMethod("format")]
		public static void AppendLine(this StringBuilder builder, string format, params object[] args)
		{
			builder.AppendFormat(format, args);
			builder.AppendLine();
		}

		/// <summary>
		/// Clears the specified builder.
		/// </summary>
		/// <param name="builder">The builder.</param>
		public static void Clear(this StringBuilder builder)
		{
			builder.Remove(0, builder.Length);
		}
	}
}